#include <atomic>

class SpinLock {
public:
    SpinLock() : m_lock(false) {}

    void lock() {
        while (m_lock.exchange(true, std::memory_order_acquire));
    }

    void unlock() {
        m_lock.store(false, std::memory_order_release);
    }

private:
    std::atomic<bool> m_lock;
};